<?php
function smarty_function_formerror($params, &$smarty)
{
	$data=null;
	if(isset($params['name'])){
		$errors=Vars::_(Core::FORM_ERRORS);
		if(isset($errors[$params['name']])){
			$template=isset($params['template'])?$params['template']:"%s";
			$return=sprintf($template,$errors[$params['name']]);
			if(isset($params['assign'])){
				$smarty->assign($params['assign'], $return);				
			}else{
				echo $return;
			}
		}
	}
}
?>